import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    private int a[] = new int[250010];
    private int b[] = new int[25010];
    private int k;
    private void Init()
    {
        int cnt = 1;
        for(int i=2;i<=250000;i++)
            if(a[i]==0)
            {
                b[cnt++] = i;
                for(int j=i+i;j<=250000;j+=i)
                    a[j] = 1;
            }
        b[1] = 3;b[2] = 4;
    }

    private class Matrix{

        public BigInteger mp[][] = new BigInteger[2][2];
        public Matrix(){
            mp[0][0] = mp[0][1] = mp[1][0] = mp[1][1] = BigInteger.ZERO;
        }

    }

    private Matrix orgin = new Matrix();
    private Matrix res = new Matrix();

    private Matrix cal(Matrix a,Matrix b){
        Matrix ans = new Matrix();
        for(int i=0;i<2;i++){
            for(int j=0;j<2;j++){
                BigInteger sum = new BigInteger("0");
                for(int k = 0;k<2;k++){
                    sum = sum.add(a.mp[i][k].multiply(b.mp[k][j]));
                }
                ans.mp[i][j] = sum;
            }
        }
        return ans;
    }

    private void solve(){
        Init();
        Scanner scanner= new Scanner(System.in);
        while(scanner.hasNext()){
            orgin = new Matrix();
            res = new Matrix();
            k = scanner.nextInt();
            orgin.mp[0][0] = orgin.mp[0][1] = orgin.mp[1][0] = BigInteger.ONE;
            orgin.mp[1][1] = BigInteger.ZERO;
            res.mp[0][0] = res.mp[1][1] = BigInteger.ONE;
            res.mp[0][1] = res.mp[1][0] = BigInteger.ZERO;
            ksm(b[k]);
            String str= res.mp[0][1].toString().trim();
            if(str.length()>9)str = str.substring(0,9);
            System.out.println(str);
        }
    }

    private void ksm(int x) {
        while(x>0){
            if(x%2==1){
                res = cal(res,orgin);
            }
            orgin = cal(orgin,orgin);
            x/=2;
        }
    }

    public static void main(String[] args) {
        new Main().solve();
    }

}
